package cn.iocoder.yudao.module.dbit.dal.mysql.noticeinfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dbit.dal.dataobject.noticeinfo.NoticeInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dbit.controller.admin.noticeinfo.vo.*;
import org.apache.ibatis.annotations.Select;

/**
 * 机构公告 Mapper
 *
 * @author 大奔
 */
@Mapper
public interface NoticeInfoMapper extends BaseMapperX<NoticeInfoDO> {

    default PageResult<NoticeInfoDO> selectPage(NoticeInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<NoticeInfoDO>()
                .eqIfPresent(NoticeInfoDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(NoticeInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(NoticeInfoDO::getId));
    }

    @Select("SELECT * FROM dbit_notice_info ORDER BY create_time DESC LIMIT #{number}")
    List<StudentNoticeReqVO> getLatestNoticeInfo(Integer number);
}